<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="com.Database.*"%>
<%@ page import="java.sql.*"%> 
<% 
  conDB db = new conDB();//新建数据库连接类实例
  db.connectDB();//开启与数据库的连接
  //Statement state = db.getConnection().createStatement();//获得数据库连接实例，并创建Statement对象
  PreparedStatement state = db.getConnection().prepareStatement("select * from personinfo");
  //ResultSet set = state.executeQuery("select * from personInfo");//执行查询，返回ResultSet对象
  ResultSet set = state.executeQuery();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>数据库查询</title>
<style>
 div {
	width:200px;
	margin:0 auto;
}
table{
  text-align: center;
}
</style>
</head>
<body>
<div>
 <table border="1">
   <thead>
   <tr>
      <th>ID</th>
      <th>name</th>
      <th>birthProvince</th>
   </tr>
   </thead>
   <tbody>
    <%
      while(set.next())
      {
    	  out.println("<tr><td>"+set.getString("id")+"</td><td>"+set.getString("name")+"</td><td>"+set.getString("birthProvince")+"</td></tr>");
      }
    %>
   </tbody>
 </table>
</div>
</body>
</html>